"""Definition of the Ordenamiento content type
"""

from AccessControl import ClassSecurityInfo

from zope.interface import implements, directlyProvides

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

from guegue.alcaldias import alcaldiasMessageFactory as _
from guegue.alcaldias.interfaces import IOrdenamiento
from guegue.alcaldias.config import PROJECTNAME

OrdenamientoSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-
    atapi.StringField('title',
                searchable=1,
                isMetadata=0,
                accessor='Title',
                widget=atapi.StringWidget(label='Título',
                                      maxlength=150,
                                      size=30,
                                      label_msgid="label_entry_title",
                                      description_msgid="help_entry_title",
                                      i18n_domain="guegue.alcaldias",
                                      description='')),
    atapi.StringField('description',
                searchable=1,
                isMetadata=0,
                accessor='Description',
                widget=atapi.TextAreaWidget(label='Presentación',
                                      label_msgid="label_entry_description",
                                      description_msgid="help_entry_description",
                                      i18n_domain="guegue.alcaldias",
                                      description='Entre una breve descripción de la ordenamiento.')),
    atapi.TextField('body',
              searchable=1,
              required=0,
              default_content_type='text/html',
              default_output_type='text/html',
              allowable_content_types=('text/plain','text/structured', 'text/html', 'text/restructured'),
              widget=atapi.RichWidget(label='Introducción',
                                label_msgid="label_entry_body",
                                description_msgid="help_entry_body",
                                i18n_domain="guegue.alcaldias",
                                description=".")),
    atapi.TextField('problematica',
              searchable=1,
              required=0,
              default_content_type='text/html',
              default_output_type='text/html',
              allowable_content_types=('text/plain','text/structured', 'text/html', 'text/restructured'),
              widget=atapi.RichWidget(label='Problemática, Riesgos y Amenazas Principales',
                                label_msgid="label_entry_problematica",
                                description_msgid="help_entry_problematica",
                                i18n_domain="guegue.alcaldias",
                                description=".")),
    atapi.TextField('alternativa',
              searchable=1,
              required=0,
              default_content_type='text/html',
              default_output_type='text/html',
              allowable_content_types=('text/plain','text/structured', 'text/html', 'text/restructured'),
              widget=atapi.RichWidget(label='Acciones y Alternativas de Ordenamiento',
                                label_msgid="label_entry_alternativa",
                                description_msgid="help_entry_alternativa",
                                i18n_domain="guegue.alcaldias",
                                description="")),
    atapi.TextField('programas',
              searchable=1,
              required=0,
              default_content_type='text/html',
              default_output_type='text/html',
              allowable_content_types=('text/plain','text/structured', 'text/html', 'text/restructured'),
              widget=atapi.RichWidget(label='Programas y Banco de Proyectos para el Ordenamiento Territorial',
                                label_msgid="label_entry_programas",
                                description_msgid="help_entry_programas",
                                i18n_domain="guegue.alcaldias",
                                description=".")),
    atapi.TextField('acciones',
              searchable=1,
              required=0,
              default_content_type='text/html',
              default_output_type='text/html',
              allowable_content_types=('text/plain','text/structured', 'text/html', 'text/restructured'),
              widget=atapi.RichWidget(label='Acciones Inmediatas',
                                label_msgid="label_entry_acciones",
                                description_msgid="help_entry_acciones",
                                i18n_domain="guegue.alcaldias",
                                description=".")),
    atapi.FileField('adjunto',
              searchable=0,
              required=0,
              widget=atapi.FileWidget(label='Documento completo',
                                label_msgid="label_entry_adjunto",
                                description_msgid="help_entry_adjunto",
                                i18n_domain="guegue.alcaldias",
                                description='Archivo completo')),

))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

schemata.finalizeATCTSchema(OrdenamientoSchema, moveDiscussion=False)

class Ordenamiento(base.ATCTContent):
    """Tipo de datos para ordenamiento territorial"""
    implements(IOrdenamiento)

    portal_type = "Ordenamiento"
    schema = OrdenamientoSchema

    #title = atapi.ATFieldProperty('title')
    #description = atapi.ATFieldProperty('description')

atapi.registerType(Ordenamiento, PROJECTNAME)
